package de.ttf.ts.control.exception;


import static java.text.MessageFormat.format;

/**
 * Exception für "fachliche" Fehlern
 * 
 * @author ub8uhm
 * 
 */
public class ServiceBusinessException extends ServiceException {

    private static final long serialVersionUID = 1L;

    private ErrorCode errorCode;

    protected ServiceBusinessException(ErrorCode e, String message) {
        super(message);
        this.errorCode = e;
    }

    public ServiceBusinessException(ErrorCode e, Object... args) {
        super(format(e.getMessage(), args));
        this.errorCode = e;
    }

    public ServiceBusinessException(Throwable t, ErrorCode e, Object... args) {
        super(format(e.getMessage(), args), t);
        this.errorCode = e;
    }

    public ErrorCode getErrorCode() {
        return errorCode;
    }

    @Override
    public String toString() {
        return super.toString() + " | ErrorCode: " + errorCode;
    }

}
